package com.sy.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sy.PageVO;
import com.sy.dto.AdminsEditDTO;
import com.sy.dto.PageDTO;
import com.sy.mapper.AdminsMapper;
import com.sy.mapper.CourseTypesMapper;
import com.sy.pojo.Admins;
import com.sy.pojo.CourseTypes;
import com.sy.service.AdminsService;
import com.sy.service.CourseTypesService;
import com.sy.vo.AdminsPageVO;
import jakarta.annotation.Resource;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


/**
 * @className: CourseTypesServiceImpl
 * @author: Mr.Liu
 * @date: 2025/10/29 13:57
 * @Version: 1.0
 * @description:课程类型业务实现
 */
@Service
public class CourseTypesServiceImpl extends ServiceImpl<CourseTypesMapper, CourseTypes> implements CourseTypesService {
   @Resource
    private CourseTypesMapper courseTypesMapper;
    @Override
    public boolean queryBeanByName(String name) {
        QueryWrapper<CourseTypes> qw = new QueryWrapper<>();
        qw.eq("name",name);
        List<CourseTypes> list = courseTypesMapper.selectList(qw);
        if(list!=null&&list.size()>0){
            //课程名不可用
            return false;
        }
        return true;
    }

    @Override
    public boolean updateName(Map<String, Object> map) {
        return courseTypesMapper.updateName(map)>0;
    }

    @Override
    public boolean updateStatus(Map<String, Object> map) {
        return courseTypesMapper.updateStatus(map)>0;
    }

    @Override
    public List<CourseTypes> queryByStatus() {
        return courseTypesMapper.queryByStatus();
    }
}
